// pages/filing/whether-car.js
Page({
    data: {
        carRadio: [{
                name: "有车",
                value: "有车",
                checked: false
            },
            {
                name: "无车",
                value: "无车",
            },
        ],
        entrustRadio: [{
                name: "有委托函",
                value: "有委托函",
            },
            {
                name: "无委托函",
                value: "无委托函",
            },
        ],
        carValue: '',
        entrustValue: '',
        isSubmit: false

    },
    onLoad: function(options) {

    },
    carChange(e) {
        var carRadio = this.data.carRadio
        var carValue = e.detail.value

        for (var i = 0, len = carRadio.length; i < len; ++i) {
            carRadio[i].checked = carRadio[i].value == carValue;
        }

        this.setData({
            carRadio,
            carValue,
        })
    },
    entrustChange(e) {
        var entrustRadio = this.data.entrustRadio;
        var entrustValue = e.detail.value

        for (var i = 0, len = entrustRadio.length; i < len; ++i) {
            entrustRadio[i].checked = entrustRadio[i].value == entrustValue;
        }

        this.setData({
            entrustRadio,
            entrustValue,
        })
    },
    next() {
        let {
            carValue = '', entrustValue = ''
        } = this.data

        entrustValue = carValue == "有车" ? '' : entrustValue
        getApp().filingData = {
            carValue,
            entrustValue
        }

        wx.navigateTo({
            url: './choose-file',
        })
    }
})